import { DIRECTION_ENUM, DRECTION_ORDER_ENUM, PARAME_NAME_ENUM } from "../../Enums"
import State from "../../base/state"
import { SubStateMachine } from "../../base/SubStateMachine"

const BASE_URL = "text/player/turnleft"

export default class TurnLeftSubStateMachine extends SubStateMachine {
  constructor(fsm) {
    super(fsm)
    this.stateMachines.set(DIRECTION_ENUM.TOP, new State(fsm, `{BASE_URL}/top`))
    this.stateMachines.set(DIRECTION_ENUM.BOTTOM, new State(fsm, `{BASE_URL}/bottom`))
    this.stateMachines.set(DIRECTION_ENUM.LEFT, new State(fsm, `{BASE_URL}/left`))
    this.stateMachines.set(DIRECTION_ENUM.RIGHT, new State(fsm, `{BASE_URL}/right`))
  }
  run() {
    const v = this.fsm.getParams(PARAME_NAME_ENUM.DIRECTION)
    this.currentState = this.stateMachines.get(DRECTION_ORDER_ENUM[v])
  }
}
